import Opt from '@/components/dt/info/Opt.js'

class SearchOpt extends Opt {
  constructor(vm) {
    super()
    this.vm = vm
    this.build()
  }

  build() {
    this.createAll()
    this.opts.push(...this.all)
  }

  createAll() {
    this.all = [
      {
        key: 'commissionMonth',
        title: '结算月份',
        placeholder: '全部',
        date: {
          type: 'month'
        }
      },
      {
        key: 'settlementType',
        title: '结算类型',
        placeholder: '全部',
        select: {
          key: 'settlementType'
        }
      },
      {
        key: 'status',
        title: '状态',
        placeholder: '全部',
        select: {
          key: 'commissionStatus',
          clearable: true
        }
      },
      {
        labelWidth: 10,
        group: [
          {
            visible: this.vm.unlocking('0111010600'),
            button: {
              type: 'primary',
              title: '历史佣金导入',
              click: () => {
                this.vm.onHistoryImport()
              }
            }
          },
          {
            visible: this.vm.unlocking('0111010700'),
            button: {
              type: 'primary',
              title: '历史佣金抹除',
              click: () => {
                this.vm.onHistoryClear()
              }
            }
          }
        ]
      }
    ]
  }
}

export default SearchOpt
